package com.java.basis.thread.n3;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @author wangning
 * @create 2022-01-24 10:56
 */
@Slf4j(topic = "c.TestReentrantLock04")
public class TestReentrantLock04 {
	private static ReentrantLock lock = new ReentrantLock();

	public static void main(String[] args) {
		//创建一个新的条件变量(等待休息室)
		Condition condition1 = lock.newCondition();
		Condition condition2 = lock.newCondition();
		lock.lock();
		//进入休息室等待
		try {
			condition1.await();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		//唤醒休息室的线程
		condition1.signal();
		condition1.signalAll();

	}

}
